import Taro, { Component } from '@tarojs/taro'
import { View, Image, Button } from '@tarojs/components'
import allExtrance from './../../config/allExtrance'
import Public from './../../api/public'
import './shareModal.less'

class ShareModal extends Component {
    constructor(props) {
        super(props)
        this.state = {
        }
    }


    componentWillReceiveProps(nextProps) {
        console.log(nextProps.counter, "nextprops")
    }

    componentDidMount() {

    }

    componentWillUnmount() { }

    componentDidShow() { }

    componentDidHide() { }

    toggleShareLayer(e) {
        e.stopPropagation()
        this.props.onToggleShareLayer()
    }

    getPoster(e) {
        e.stopPropagation()
        this.props.onGetPoster()
    }

    render() {
        let { modalInfo } = this.props
        return (
            <View className='shareModal'>
                <View className='share-layer' onClick={this.toggleShareLayer.bind(this)}>
                    <View className='content'>
                        <View className='item'>
                            <Button open-type='share'>
                                <Image className='icon' src='https://file.open.banchengyun.com/2019/04/03/155428342460352.png' />
                                <View className='text'>发给好友</View>
                            </Button>
                            {/* <Btn open-type='share' my-class='btn-share' title=''></Btn> */}
                        </View>
                        {
                            Taro.getEnv() === Taro.ENV_TYPE.WEAPP && <View className='item' onClick={this.getPoster.bind(this)}>
                                <Image className='icon' src='https://file.open.banchengyun.com/2019/04/03/155428342476471.png' />
                                <View className='text'>生成海报</View>
                            </View>
                        }
                    </View>
                </View>
            </View>
        )
    }
}

export default ShareModal
